package com.keyingbo.orm.demo.service;

import com.keyingbo.orm.demo.entity.Member;
import com.keyingbo.orm.framework.IEntityStatement;
import com.keyingbo.orm.framework.annotation.EntityStatement;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: KEYB
 * @Date: 2019-4-28 14:16
 * @Description:
 */
@Service
public class MemberService {
    @EntityStatement
    private IEntityStatement<Member> entityStatement;

    public Member findOneById(int id){
        return entityStatement.find(id);
    }
    public List<Member> findAll(){
        return entityStatement.findAll();
    }

    public void inserMember(Member member){
        entityStatement.create(member);
    }
    public void updateMember(Member member) throws  Exception{
        entityStatement.update(member);
    }

    public void deleteMember(Member member) throws  Exception{
        entityStatement.delete(member);
    }
}
